
#include <stdio.h>
#include <string.h>

typedef struct Student
{
    char name[20];
    int age;
    char sex;
    char password[20];

}Student_t;

typedef struct form
{
   Student_t stu[3];
   int num;
}L;

void init(struct form *p)
{
    if(p == NULL)
    {
        return;
    
    }
    p->num = 0;
}

void insert(struct form *p , Student_t *stu)
{
    if(p == NULL)
    {
        return;
    
    }
    if(p->num >= 3 )
    {
        printf("结构体已满\n");
        return;
    }
    p->stu[p->num] = *stu;
    p->num++;
}

void delete(struct form *p )
{
     if(p == NULL)
    {
        return;
    
    }
    if (p->num == 0)
    {
        printf("结构体为空\n");
        return;
    }
    p->num--;
}

void print(struct form *p)
{
    for(int i = 0; i < p->num; i++)
    {
        printf("name:%s,age:%d,sex:%c\n",p->stu[i].name,p->stu[i].age,p->stu[i].sex);
    }

}

int empty(struct form *p)
{
    if( p->num == 0)
    {
        return 1;
    
    }
}

int main()
{
    L l;
    init(&l);
    Student_t s1 = {"jack",18,'男'};
    Student_t s2 = {"rose",19,'女'};
    insert(&l,&s1);
    insert(&l,&s2);
    print(&l);
    delete(&l);
    print(&l);
    return 0;

}